import request from '@/utils/request'

export function getDevice(data) {
  return request({
    url: '/device',
    method: 'get',
    params:data
  })
}

export function getDeviceDetail(data) {
  return request({
    url: '/device/' + data,
    method: 'get'
  })
}

export function createDeviceQRcode(data) {
  return request({
    url: '/device/create_qr_code/' + data,
    method: 'get'
  })
}

export function manualOpenDevice(data) {
  return request({
    url: '/device/manual_open/' + data.id,
    method: 'post',
    data
  })
}

export function addDevice(data) {
  return request({
    url: '/device',
    method: 'post',
    data
  })
}

export function editDevice(data) {
  return request({
    url: '/device/' + data.id,
    method: 'put',
    data
  })
}

export function removeDevice(data) {
  return request({
    url: '/device/' + data,
    method: 'delete',
  })
}

export function simulatePlate(data) {
  return request({
    url: '/device/push',
    method: 'post',
    data
  })
}



export function getGate(data) {
  return request({
    url: '/gate',
    method: 'get',
    params:data
  })
}

export function getGateDetail(data) {
  return request({
    url: '/gate/' + data,
    method: 'get'
  })
}

export function addGate(data) {
  return request({
    url: '/gate',
    method: 'post',
    data
  })
}

export function editGate(data) {
  return request({
    url: '/gate/' + data.id,
    method: 'put',
    data
  })
}

export function removeGate(data) {
  return request({
    url: '/gate/' + data,
    method: 'delete',
  })
}

export function getNowOutPlate(data) {
  return request({
    url: '/gate/' + data + "/now_out",
    method: 'get'
  })
}
